testsuite: Don't exit unsuccessfully when using TAP
authorMatthias Clasen <mclasen@redhat.com>
Fri, 20 Mar 2020 15:43:51 +0000 (11:43 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Fri, 20 Mar 2020 15:55:26 +0000 (11:55 -0400)
The meson TAP parser doesn't take this lightly and
forgets all about xfails when we exit(1), so don't.

testsuite/reftests/gtk-reftest.c

index 9ddd0dab1e60fe24ddbb6cf4791380f6766029cc..c09147a6cc22b171500ce5538cdfc45b3ea5a458 100644 (file)
@@ -57,11 +57,14 @@ static const GOptionEntry test_args[] = {
   { NULL }
 };
 
+static gboolean using_tap;
+
 static gboolean
 parse_command_line (int *argc, char ***argv)
 {
   GError *error = NULL;
   GOptionContext *context;
+  int i;
 
   context = g_option_context_new ("- run GTK reftests");
   g_option_context_add_main_entries (context, test_args, NULL);
@@ -73,6 +76,12 @@ parse_command_line (int *argc, char ***argv)
       return FALSE;
     }
 
+  for (i = 0; i < *argc; i++)
+    {
+      if (strcmp ((*argv)[i], "--tap") == 0)
+        using_tap = TRUE;
+    }
+
   gtk_test_init (argc, argv);
 
   if (g_strcmp0 (arg_direction, "rtl") == 0)
@@ -379,6 +388,7 @@ int
 main (int argc, char **argv)
 {
   const char *basedir;
+  int result;
   
   /* I don't want to fight fuzzy scaling algorithms in GPUs,
    * so unless you explicitly set it to something else, we
@@ -424,6 +434,11 @@ main (int argc, char **argv)
    */
   chdir (basedir);
 
-  return g_test_run ();
+  result = g_test_run ();
+
+  if (using_tap)
+    return 0;
+
+  return result;
 }